// 获取年住院人次人头综合分析数据
export function getInHosPeopTimesPeopNumData(planAreaId, hospitalId) {
  const data = Object.assign({}, {
    planAreaId,
    hospitalId
  })
  return window.axios.post('api/report/queryInHospitalCountsNumsRatio', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}

// 平均住院日综合分析接口
export function getYearAverageInHosDaysData(planAreaId, hospitalId) {
  const data = Object.assign({}, {
    planAreaId,
    hospitalId
  })
  return window.axios.post('api/report/queryAvgInHospitalDay', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}

// 百元医疗收入消耗的卫生材料费用接口
export function getHundredMedCostCustomData(planAreaId, hospitalId) {
  const data = Object.assign({}, {
    planAreaId,
    hospitalId
  })
  return window.axios.post('api/report/queryHygieneIn100MedicalOperation', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}

// 各医疗类别占医疗收入比重分析接口
export function getMedicalTypeAnalyseData(year, planAreaId, hospitalId, freeSortType) {
  const data = Object.assign({}, {
    year,
    planAreaId,
    hospitalId,
    freeSortType
  })
  return window.axios.post('api/report/queryMedicalsInMedicalOperation', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}

// 收入类别占医疗收入比重分析接口
export function getCostTypeAnalyseData(year, planAreaId, hospitalId) {
  const data = Object.assign({}, {
    year,
    planAreaId,
    hospitalId
  })
  return window.axios.post('api/report/queryChargesInMedicalOperation', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}

// 获取医院就诊人次人数占比分析左侧直方图
export function getHospitalInPeopleNumData(areaCode, hospLevel, medicalCategory, queryYear, type) {
  const data = Object.assign({}, {
    areaCode,
    hospLevel,
    medicalCategory,
    queryYear,
    type
  })

  return window.axios.post('api/person/treatmentProportionAnalysis', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}


// 获取医院就诊人次人数占比分析左侧直方图----右侧
export function getHospitalInPeopleNumDataRight(areaCode, hospLevel, medicalCategory, queryYear) {
  const data = Object.assign({}, {
    areaCode,
    hospLevel,
    medicalCategory,
    queryYear
  })

  return window.axios.post('api/report/treatmentPersonAnalysis', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}


// 获取10种典型单病种例均费用
export function getTenSingleTypeDiseaseCostData(queryYear, areaCode, hospLevel, hospCode,
                                                medicalCategory, typicalDrgs) {
  const data = Object.assign({}, {
    queryYear,
    areaCode,
    hospLevel,
    hospCode,
    medicalCategory,
    typicalDrgs
  })

  return window.axios.post('api/report/typicalDrgsCasesCostAnalysis', data)
    .then((res) => {
      console.log(res.data)
      return Promise.resolve(res.data)
    })
    .catch((error) => {
      console.log(JSON.stringify(error))
      return Promise.reject(error)
    })
}
